package com.tianqu.tms.entity;

import java.sql.Timestamp;

import com.tianqu.tms.core.exception.TmsDaoException;
import com.tianqu.tms.core.util.StringUtil;
import com.tianqu.tms.dao.CarDao;
import com.tianqu.tms.dao.MarketCarTranserInfoDao;
import com.tianqu.tms.dao.TmsDao;
import com.tianqu.tms.dto.MarketCarTransferInfoDto;

/**
 * @author zhangxueliang
 * 老数据entity
 */
public class MarketCarTransferInfo extends ViewListManager{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String serial;
	private String transferSerial;
	private String vendorCode;
	private String modelCode;
	private Timestamp acceptTime;
	private String licensePlate;
	private String vin;
	private int didisplacement;
	private int gearbox;
	private String vendorId;
	private String brandId;
	private String carStyleId;
	private String carName;
	
	/**
	 * @param serial
	 * @return
	 * @throws TmsDaoException
	 */
	public MarketCarTransferInfo findMarketCarTransferInfo(String serial) throws TmsDaoException{
		MarketCarTransferInfo entity = new MarketCarTransferInfo();
		MarketCarTranserInfoDao marketCarTranserInfoDao = (MarketCarTranserInfoDao) TmsDao.getInstance(TmsDao.TMS_MARKET_CAR_TRANS_INFO);
		MarketCarTransferInfoDto dto = new MarketCarTransferInfoDto();
		dto = marketCarTranserInfoDao.findMarketCarTranserInfo(serial);
		if(dto != null){
			if(!StringUtil.isNullOrBlank(dto.getBasicCarId())){
				entity.setSerial(dto.getBasicCarId());
				entity.setTransferSerial(dto.getSerial());
				entity.setVendorCode(dto.getVendorCode());
				entity.setModelCode(dto.getModelCode());
				entity.setAcceptTime(dto.getAccpetTime());
				entity.setVin(dto.getVin());
				entity.setLicensePlate(dto.getLicensePlate());
				entity.setDidisplacement(dto.getDidisplacement());
				entity.setGearbox(dto.getGearbox());
				entity.setBrandId(dto.getBrandId());
				entity.setVendorId(dto.getVendorId());
				entity.setCarStyleId(dto.getCarStyleId());
			}
		}
		
		return entity;
	}
	public void updateMarketCarTransferInfo(MarketCarTransferInfo entity) throws TmsDaoException{
		MarketCarTransferInfoDto dto = new MarketCarTransferInfoDto();
		dto.setSerial(entity.getSerial());
		dto.setVendorCode(entity.getVendorCode());
		dto.setModelCode(entity.getModelCode());
		dto.setVin(entity.getVin());
		dto.setLicensePlate(entity.getLicensePlate());
		dto.setDidisplacement(entity.getDidisplacement());
		dto.setGearbox(entity.getGearbox());
		dto.setBrandId(entity.getBrandId());
		dto.setVendorId(entity.getVendorId());
		dto.setCarStyleId(entity.getCarStyleId());
		dto.setCarName(entity.getCarName());
		MarketCarTranserInfoDao marketCarTranserInfoDao = (MarketCarTranserInfoDao) TmsDao.getInstance(TmsDao.TMS_MARKET_CAR_TRANS_INFO);
		marketCarTranserInfoDao.updateMarketCarTranserInfo(dto);
	} 

	public String getCarName() {
		return carName;
	}
	public void setCarName(String carName) {
		this.carName = carName;
	}
	public String getSerial() {
		return serial;
	}
	public void setSerial(String serial) {
		this.serial = serial;
	}
	public String getTransferSerial() {
		return transferSerial;
	}
	public void setTransferSerial(String transferSerial) {
		this.transferSerial = transferSerial;
	}
	public String getVendorCode() {
		return vendorCode;
	}
	public void setVendorCode(String vendorCode) {
		this.vendorCode = vendorCode;
	}
	public String getModelCode() {
		return modelCode;
	}
	public void setModelCode(String modelCode) {
		this.modelCode = modelCode;
	}
	public Timestamp getAcceptTime() {
		return acceptTime;
	}
	public void setAcceptTime(Timestamp acceptTime) {
		this.acceptTime = acceptTime;
	}
	public String getLicensePlate() {
		return licensePlate;
	}
	public void setLicensePlate(String licensePlate) {
		this.licensePlate = licensePlate;
	}
	public String getVin() {
		return vin;
	}
	public void setVin(String vin) {
		this.vin = vin;
	}

	public int getDidisplacement() {
		return didisplacement;
	}

	public void setDidisplacement(int didisplacement) {
		this.didisplacement = didisplacement;
	}


	public int getGearbox() {
		return gearbox;
	}


	public void setGearbox(int gearbox) {
		this.gearbox = gearbox;
	}

	public String getVendorId() {
		return vendorId;
	}


	public void setVendorId(String vendorId) {
		this.vendorId = vendorId;
	}

	public String getBrandId() {
		return brandId;
	}

	public void setBrandId(String brandId) {
		this.brandId = brandId;
	}

	public String getCarStyleId() {
		return carStyleId;
	}


	public void setCarStyleId(String carStyleId) {
		this.carStyleId = carStyleId;
	}
	
	
	

}
